package com.sx.micowell.framework.model

import com.example.mvvm.base.data.MutableLiveListData
import com.example.mvvm.base.vm.BaseViewModel
import com.example.mvvm.until.LogUtils
import com.example.mvvm.until.SPUtils
import com.example.mvvm.until.ToastUtils
import com.miloyu.modelnet.network.ApiResponse
import com.miloyu.modelnet.network.HttpClient
import com.miloyu.modelnet.network.service.IApiService
import com.miloyu.modelnet.network.tools.RxUtils
import com.miloyu.modelnet.response.*
import com.sx.micowell.framework.app.SPKey
import com.sx.micowell.framework.arouth.RouteManager
import java.util.HashMap

/**
 * @Author: YY
 * @Time: 2021/8/13
 * @Describe TODO
 */
class HelpModel : BaseViewModel() {

    var helpListData: MutableLiveListData<HelpInfoVO> = MutableLiveListData<HelpInfoVO>()


    fun getHelpInfo() {
        addSubscribe(HttpClient.instance.apiService
                .getHelpInfo()
                .compose(RxUtils.compose())
                .subscribeWith(object : ApiResponse<HelpInfoWrap>() {

                    override fun success(data: HelpInfoWrap?, msg: String?) {
                        helpListData.addData(data?.info)
                        ui.hideDialog()
                    }

                    override fun onFail(e: Throwable?, errorMsg: String?) {
                        ToastUtils.showShort("$errorMsg")
                        ui.hideDialog()
                    }
                })
        )
    }

}